<?php
/**
 * Created by JetBrains PhpStorm.
 * User: thinhhung
 * Date: 7/1/12
 * Time: 9:53 PM
 * To change this template use File | Settings | File Templates.
 */

echo $this->Session->read('hdmoinhat');


?>
<?php echo $this->Form->create('HoaDonBan', array('action' => 'add')); ?>
<fieldset>
    <legend>THÔNG TIN KHÁCH HÀNG</legend>
    <dl>
        <dt><label>Tên khách hàng</label></dt>
        <dd><?php echo $this->Form->input('TENKH', array('label' => false, 'class' => 'required')); ?></dd>
    </dl>
    <dl>
        <dt><label>Địa chỉ</label></dt>
        <dd><?php echo $this->Form->input('DIACHIKH', array('label' => false, 'rows'=> 3, 'cols' => 50)); ?></dd>
    </dl>
    <dl>
        <dt><label>Số điện thoại</label></dt>
        <dd><?php echo $this->Form->input('DTKH', array('label' => false, 'class' => 'required')); ?></dd>
    </dl>
</fieldset>

<?php echo $this->Form->end(); ?>
<?php
$data = $this->Js->get('#HoaDonBanAddForm')->serializeForm(
    array(
        'isForm' => true,
        'inline' => true)
);

// Submit the serialize data on submit click

$this->Js->get('#HoaDonBanAddForm')->event(
    'submit',
    $this->Js->request(
        array('action' => 'add'),
        array(
            'update' => '#updateDATA', // element to update
            // after form submission
            'data' => $data,
            'async' => true,
            'dataExpression'=>true,
            'method' => 'POST'
        )
    )
);


echo $this->Form->create('ChiTietBan', array( 'action' => 'add', 'default' => false)); ?>
<fieldset>
    <legend><label>Thêm hàng hóa bán</label></legend>
    <dl>
        <dt><label>MAHDB</label></dt>
        <dd><?php echo $this->Form->input('MAHDB', array('label' => false)); ?></dd>
    </dl>
    <dl>
        <dt><label>ID hàng hóa</label></dt>
        <dd><?php echo $this->Form->input('MASP', array('label' => false)); ?></dd>
    </dl>
    <dl>
        <dt><label>Số lượng</label></dt>
        <dd><?php echo $this->Form->input('SLBAN', array('label' => false)); ?></dd>
    </dl>
    <dl>
        <dt><label>Đơn giá (VNĐ)</label></dt>
        <dd><?php echo $this->Form->input('DONGIABAN', array('label' => false)); ?></dd>
    </dl>
    <?php echo $this->Form->end('Thêm sản phẩm',  array('update' => '#updateDATA'));
    echo $this->Js->writeBuffer();?>
</fieldset>
<?php
//echo $this->Form->end();
?>

<?php ?>
<!--<table>
    <tr>

        <th><?php /*echo 'MÃ HÀNG HÓA'; */?></th>
        <th><?php /*echo 'SỐ LƯỢNG'; */?></th>
        <th><?php /*echo 'ĐƠN GIÁ BÁN (VNĐ)'; */?></th>
        <th>THAY ĐỔI</th>
    </tr>

    <?php /*//print_r($bans); */?>
    <?php /*if (isset($bans)) foreach ($bans as $ban): */?>
    <tr>
        <td><?php /*echo $ban['ChiTietBan']['MASP']; */?></td>
        <!-- $this->Html->link($hanghoa['HangHoa']['TenHG'],
//    array('controller' => 'hanghoas', 'action' => 'view', $hanghoa['HangHoa']['TenHG'])) -->
        <td><?php /*echo $ban['ChiTietBan']['SLBAN']; */?></td>
        <td><?php /*echo $ban['ChiTietBan']['DONGIABAN']; */?></td>
        <td><?php /*//echo $this->Html->link('Sửa', array('action' => 'index', $ban['Ban']['MaHG']));
            if ($this->Session->read('quyen') != 'nhanvien') {
                echo $this->Html->link($this->Html->image('/images/user_edit.png'), array('action' => 'edit', $ban['ChiTietBan']['id']), array('escape' => false));
            }  else echo '&nbsp';*/?>
            <?php
/*            if ($this->Session->read('quyen') == 'quantri') {
                echo $this->Html->link($this->Html->image('/images/trash.png'), array('action' => 'delete', $ban['ChiTietBan']['id']),
                    array('confirm' => 'Bạn có chắc muốn xóa?', 'escape' => false));
            } */?>

 <!--       </td>
    </tr>
    <?php /*endforeach; */?>
</table>-->



<?php
   // echo $this->Form->submit('Lưu');
    //echo $this->Form->end();
?>